$(document).ready(function () {	
	findAllMackupByEId();
	//findAllMackupAnnexByEId();
	findAllDAByEId();
	$('#mackup_down').click(function () {
		$('#mackup_down').hide();
		$('#mackup_up').show();
		$("#mackups").show();
	});
	$('#mackup_up').click(function () {
		$('#mackup_up').hide();
		$('#mackup_down').show();
		$("#mackups").hide();
	});
	
	$('#da_down').click(function () {
		$('#da_down').hide();
		$('#da_up').show();
		$("#das").show();
	});
	$('#da_up').click(function () {
		$('#da_up').hide();
		$('#da_down').show();
		$("#das").hide();
	});
	
	$('#sjly').click(function () {
		//alert($("#tapeRecord").text());
		$('#tabFrame',window.parent.parent.frames['mainFrame'].document).
			attr("src",$("#tapeRecord").text());
	});
	
});	
	function findAllMackupByEId(){
		var eid=$("#eid").text();
		$.ajax({
			type: "post",
			data:{'EId':eid},
			url: "wzp/eventMackup_findByEId.action",
			success:function(data){
				$("#mackups").empty();
				var strHTML = "";
				if(data.mackups.length>0){
					$.each(data.mackups,function(i,n){
						var j = i + 1;
						strHTML += "<tr><td bgcolor='#dceffd'>";
	          			strHTML += "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='1' bgcolor='#84b1d3' >"; 
	          			strHTML += "<tr><td width='104'><span style='float: left; padding-top:20;width:104;text-align:right'>事件补充"+j+"：</span></td>";
	          			strHTML += "<td><table>";
	          			strHTML += "<tr height='26' ><td style='padding-bottom:5px;border-bottom:1px solid #84b1d3;width:2000px;'>补充人："+n.tbUser.UName+"   补充时间："+n.emTime.replace(/T/," ");
	          			strHTML += "</td></tr>";
	          			strHTML += "<tr ><td >补充内容：<div style='padding-left:40px;padding-top:5px;border-bottom:1px solid #84b1d3;'>"+n.emContext+"</div></td></tr>";
	          			strHTML += "<tr><td>附件：";
	          			if(n.tbMackupAnnexes.length>0){
	          				$.each(n.tbMackupAnnexes,function(k,m){
								strHTML += "<div style='padding-left:40px;padding-top:5px;'>" +
										"<a href=\"/ag/file/download.action?fileRealName="+m.maName+"&fileDiskURL="+m.maAddress+"&moduleID=103\">"+m.maName+"</a></div>";
							});
	          			}else{
	          				strHTML += "<div style='padding-left:40px;'>没有附件</div>";
	          			}
	          			
	          			strHTML += "</td></tr>"; 
	          			strHTML += "</table></td>";
	        			strHTML += "</table></td></tr>";
						/*strHTML += "<tr class='trtab'>";
						strHTML += "<td class='tdtab2' colspan='3'>";
						strHTML += "<span style='float: left; padding-top:20;width:104;text-align:right'>事件补充"+j+"：</span>";
						strHTML += "<span class='textAeraRight'>补充人："+n.tbUser.UName+"   补充时间："+n.emTime.replace(/T/," ");
						strHTML += "<span class='textAeraRight'>"+n.emContext+"</span>";
						if(n.tbMackupAnnexes.length>0){
							$.each(n.tbMackupAnnexes,function(k,m){
								strHTML += "<span class='textAeraRight'>"+m.maName+"</span>";
							});
						}
						strHTML += "</span></td></tr>";*/
					});
				}else{
					strHTML += "<tr class='trtab'>";
					strHTML += "<td class='tdtab' colspan='3'>";
					strHTML += "<span style='padding-left:20'>没有补充内容<span></td></tr>";
				}
				$("#mackups").append(strHTML);
				$("#mackups").show();
			}
		});
	}
	function findAllMackupAnnexByEId(){
		var eid=$("#eid").text();
		$.ajax({
			type: "post",
			data:{'EId':eid},
			url: "wzp/eventMackup_findMackupAnnexByEId.action",
			success:function(data){
				$("#mackupAnnexs").empty();
				var strHTML = "";
				if(data.mackupAnnexs.length>0){
					
					$.each(data.mackupAnnexs,function(i,n){
						strHTML += "<tr class='trtab'>";
						strHTML += "<td class='tdtab2' colspan='3'>";
						var j = i + 1;
						strHTML +="<div style='padding-left:20px;height:20px;'>"+j+"、<a href=\"#\">"+n.maName+"</a></div>"; 
						strHTML +="</td></tr>";
					});
					
				}else{
					strHTML += "<tr class='trtab'>";
					strHTML += "<td class='tdtab' colspan='3'>";
					strHTML += "<span style='padding-left:20'>没有附件<span></td></tr>";
				}
				$("#mackupAnnexs").append(strHTML);
				$("#mackupAnnexs").show();
			}
		});
	}
	function findAllDAByEId(){
		var eid=$("#eid").text();
		$.ajax({
			type: "post",
			data:{'EId':eid},
			url: "wzp/eventBase_findAllDAByEId.action",
			success:function(data){
				$("#das").empty();
				var strHTML = "";
				if(data.das.length>0){
					var j=0;
					$.each(data.das,function(i,n){
						if(n.daContent!=null && n.daSubmitTime!=null){
							j = j + 1;
							strHTML += "<tr class='trtab'>";
							strHTML += "<td class='tdtab2' colspan='3'>";
							strHTML += "<span style='float: left; padding-top:20;width:104;text-align:right'>处置建议"+j+"：</span>";
							strHTML += "<span class='textAeraRight'>建议人："+n.tbUserByAdviceUId.UName+"   建议时间："+n.daSubmitTime.replace(/T/," ");
							strHTML += "<span class='textAeraRight'>"+n.daContent+"</span>";
							strHTML += "</span></td></tr>";
						}
					});
				}else{
					strHTML += "<tr class='trtab'>";
					strHTML += "<td class='tdtab' colspan='3'>";
					strHTML += "<span style='padding-left:20'>还没有处置建议<span></td></tr>";
				}
				$("#das").append(strHTML);
				$("#das").show();
			}
		});
	}
//	function findAllDAByEId(){
//		var eid=$("#eid").text();
//		$.ajax({
//  			type: "post",
// 			data: {"EId":eid},
//			url: "wzp/eventBase_getAllDAByEId.action",
//  			success:function(data){
//  				if(data.das.length>0){
//  					$("#DAArea").show();
//  					$.each(data.das,function(i,n){
//						$("#DAAreaHead").append("<span style='padding-left:5' ><button class='button' id='"+n.daId+"'>"+n.tbSubmit.tbDept.DName+"</button></span>");  	
//						$("#DAAreaUtil").append("<div style='display:none' class='"+n.daId+"'>" +
//								"<span style='padding-left:10'>建议人：" +n.tbUser.UName+"</span>" +
//								"<span style='padding-left:30'>建议时间："+n.daTime.replace(/T/," ")+"</span></div>");
//						$("#DAAreaBody").append("<span style='display:none' class='"+n.daId+"'>"+
//								"<span class='textAeraLeft "+n.daId+"' >建议内容：</span><span class='textAeraRight "+n.daId+"'>"+n.daContent+"</span></span>");
//						var did="#"+n.daId;
//						var cid="."+n.daId;
//						$(did).click(function(){
//							$('#DAAreaHead button').attr("class","button");
//							$('#DAAreaBody span').css('display','none');
//							$('#DAAreaUtil div').css('display','none');
//							$(this).attr("class","clickbutton");
//							$(cid).css('display','block');
//						});
//  					});
//  					$('#DAAreaHead button').first().attr("class","clickbutton");
//  					$('#DAAreaUtil div').first().show();
//  					$('#DAAreaBody span').first().show();
//  				}
//  			}  		 
//		});
//	}
	
